<?php

class ModelCatalogCustomtour extends Model
{
    public function saveCustomTour($dataArray)
    {
        $query = $this->db->query("INSERT INTO custom_tour (cities,startdate,numdate,tripname,suites,accommodation,firstname,lastname,telephone,email,address,hearfrom,city,postcode,country_id,zone_id) VALUES ('" . $dataArray['cities'] . "','" . $dataArray['startdate'] . "','" . $dataArray['numdate'] . "','" . $dataArray['tripname'] . "','" . implode(",", $dataArray['suites']) . "','" . implode(",", $dataArray['accommodation']) . "','" . $dataArray['firstname'] . "','" . $dataArray['lastname'] . "','" . $dataArray['telephone'] . "','" . $dataArray['email'] . "','" . $dataArray['address'] . "','" . $dataArray['hearform'] . "','" . $dataArray['city'] . "','" . $dataArray['postcode'] . "','" . $dataArray['country_id'] . "','" . $dataArray['zone_id'] . "');");
    }

    public function getcustomtour($start = 0, $limit = 10)
    {
        $start = $start * $limit;
        $query = $this->db->query("SELECT * FROM `custom_tour` WHERE status <> 'Done' AND status <> 'Cancel' ORDER BY startdate desc LIMIT " . (int)$start . "," . (int)$limit);
        return $query->rows;
    }

    public function updatecustomtour($tourId, $status, $reason)
    {
        $this->db->query("UPDATE `custom_tour` SET status='" . $status . "', reason='" . $reason . "' WHERE custom_tour_id=" . $tourId);
    }
}

?>